//
//  CXYBaseTableViewController.swift
//  诚叙缘
//
//  Created by sujeking on 17/3/20.
//  Copyright © 2017年 szw. All rights reserved.
//

import UIKit

class CXYBaseTableViewController: UITableViewController {
    
    var rightBarButtonItemTitle : NSString?{
        didSet{
            let rightItem = UIBarButtonItem(title: rightBarButtonItemTitle as String?, style: UIBarButtonItemStyle.plain, target: self, action: nil);
            self.navigationItem.rightBarButtonItem = rightItem
        }
    }
    
    var rightItemClickAction : Selector? {
        didSet{
            self.navigationItem.rightBarButtonItem?.action = rightItemClickAction
        }
    }
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        setupUI()
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    func setupUI() {
        let backItem = UIBarButtonItem(image: #imageLiteral(resourceName: "ic_navbar_back"), style: UIBarButtonItemStyle.plain, target: self, action: #selector(CXYBaseTableViewController.backAction))
        self.navigationItem.leftBarButtonItem = backItem
    }
    
    func backAction() {
        _ = self.navigationController?.popViewController(animated: true)
    }
    
    override func numberOfSections(in tableView: UITableView) -> Int {
        return 0
    }
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 0
    }
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        tableView.deselectRow(at: indexPath, animated: true)
    }
    
    override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
        let footerView : UIView = UIView()
        footerView.backgroundColor = normalViewBGColor
        return footerView
    }
}
